#ifndef SLOTRESULT_H
#define SLOTRESULT_H

#include "lib.h"

#pragma warning( disable: 4786 )

#include <vector>

using namespace std;



struct SpinLine
{
    public:
        ///  The line number. 
        uint8 lineid;           
        ///* @breif the number of cents won.
        int32 payoutamount;
        /// @breif   Did they win the jackpot?
        bool8 jackpot;          
        /// @brief The pay table result. 
        uint8 payouttypeid;     
};

struct BonusGame
{
    uint8 bonusgamenum;
    uint8 playerchoice;
    int32 winresult;
};

class SlotScatter
{
    public:
	  SlotScatter()
        {
            scatterposition = 0;
            payoutamount = 0;
            jackpot = false;
            payouttypeid = 0;
        }

        ///  The line number. 
        int32 scatterposition;           
        /// @brief the number of cents won.
        int32 payoutamount;
        /// @brief   Did they win the jackpot?
        bool8 jackpot;          
        /// @brief The pay table result. 
        uint8 payouttypeid;     
};

class SlotSpin
{
	public:
		SlotSpin();
		~SlotSpin();

		void setStops(uint8 stopCount, uint8 *stops);

        void setPayoutAmount(uint8 lineid, int32 payoutamount, bool8 jackpot, uint8 payouttypeid);

        void setJackpotAmount(uint8 lineid, int32 jackpotamount);

        void addLine(uint8 lineid);

        void setBet(uint8 bet);

        void setSpinSent(bool8 flag);
        bool8 isSpinSent();

        void setSpinSaved(bool8 flag);
        bool8 isSpinSaved();

        void setSpinComplete(bool8 flag);
        bool8 isSpinComplete();

        uint8 getSpinLineCount() const;
        SpinLine *getSpinLineAt(uint8 index);
        SpinLine *getSpinLineByLineId(uint8 lineid);

        void addScatter( int32 scatterposition, int32 payoutamount, bool8 jackpot, uint8 payouttypeid );
        void clearScatters();
        uint8 getNumScatters() const;
        SlotScatter* getScatter(uint8 nIndex) const;

        uint8 getBet() const;

        int32 getMultibankBet() const;
        void setMultibankBet(int32 bet);

        int32 getMultibankPayout() const;
        void setMultibankPayout(int32 payout);

        bool8 getJackpot();

        uint16 getTotalBet() const;
        int32 getTotalPayoutAmount();

        void setGameNum(int32 gameNum);
        int32 getGameNum() const;

        uint8 getStopCount() const;
        const uint8 *getStops() const;

        uint8 getBonusGameType() const;
        void setBonusGameType(uint8 bonusGameType);

        void addBonusGame(uint8 bonusgamenum, uint8 playerchoice, int32 winresult);
        BonusGame *getBonusGame(int32 nIndex) const;    // kharmon.  07-25-07.  #19498.  Need to update fun balance with bonus wins.
        int32 getNumBonusGames() const;

        int32 getTotalBonusPayoutAmount();
        int32 getTotalSpinPayoutAmount();

    private:
        typedef vector<SpinLine *> SpinLines;
        typedef vector<SlotScatter *> Scatters;
        typedef vector<BonusGame *> BonusGames;

        SpinLine *findSpinLine(uint8 lineid) const;
        BonusGame *findBonusGame(uint8 bonusGameNum) const;
        SlotScatter* findScatter(uint8 payouttypeid) const;

        SpinLines m_spinLines;
        BonusGames m_bonusGames;
        Scatters   m_scatters;

        uint8 m_bet;              //  The bet in credits.
        int32 m_multibankBet;     // The amount contributed to multi-bank.
        int32 m_multibankPayout;  // The amount won via multi-bank.
        uint8 m_stopCount;        //  The number of stops.
        uint8 *m_stops;           //  The actual wheel stops.
        int32 m_gameNum;         //  The game number.  Only set after it is saved.
        uint8 m_bonusGameType;
        bool8 m_spinComplete;   // A flag indicating this spin is complete and ready for saving.
        bool8 m_spinSaved;      // true if the spin is saved.
        bool8 m_spinSent;      // true if the spin has been sent to the client
};



#endif

